<template>
  <div id="app">
    <Navigation />
    
    <!-- <div id="main-content">
      <router-view/>
    </div> -->
   
      <router-view/>

    <Footer />

    <el-dialog title="密码验证" :visible.sync="confirmVisible" width="50%" center :append-to-body="true">
      <div>
        <el-input v-model="reconfirmPassword" type="password"></el-input>
      </div>

      <span slot="footer" class="dialog-footer">
        <el-button @click="closeConfirm()">取消</el-button>
        <el-button type="primary" @click="confirmPass()">确定并进入支付页面</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import api from '@/utils/api'
import Navigation from '@/components/common/navigation.vue'
import Footer from '@/components/common/footer.vue'
import {
  mapGetters
} from 'vuex'
export default {
  data() {
    return {
      reconfirmPassword: ''
    }
  },
  components: {
    Navigation,
    Footer
  },
  mounted() {
     var href = "http://gk.tianshanzw.cn/99/nceeSysMgr/index.html#/app/menu/member/desc";
     var userSource = href.substring(href.indexOf("cn/")+3, href.indexOf("nceeSysMgr")-1);
     document.cookie="nodeId="+userSource; 
    const fullPage = document.getElementById('app')
    fullPage.style.height = window.innerHeight - 54 + 'px'
  },
  computed: {
    ...mapGetters({
      confirmVisible: 'common/getConfirm'
    })
  },
  methods: {
    closeConfirm() {
      this.$store.dispatch('common/changeConfirm')
    },
    confirmPass() {
      api({
        url: "/nceeSysMgr/rest/LoginUtil/login",
        method: "post",
        data: {
          username: JSON.parse(localStorage.getItem("user")).userId,
          password: this.reconfirmPassword
        }
      }).then(res => {
        console.log(res, '  reconfirm ')
        if (res.data.state === "success") {
          this.$router.push('/paymentrecord')
          this.$store.dispatch('common/changeConfirm')
        } else {
          this.$message({
            message: '密码错误，请重新输入！',
            type: 'warning'
          })
          this.reconfirmPassword = ''
        }
      });
    },
  }
}
</script>


<style>

html, body {
  background: url('./assets/home/home_background_default@2x.png') no-repeat center center fixed; 
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
  margin: 0;
  padding: 0;
  height: 100%;
  overflow-x: hidden;
}

#main-content{
  padding-bottom: 60px;
}
</style>
